//

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Cart from '../views/Cart.vue'
import Category from '../views/Category.vue'
import ProductList from '../views/ProductList.vue'
import ProductDetail from '../views/ProductDetail.vue'
import User from '../views/User.vue'
import Order from '../views/Order.vue'
import OrderDetail from '../views/OrderDetail.vue'
import Setting from '../views/Setting.vue'
import Address from '../views/Address.vue'
import AddressEdit from '../views/AddressEdit.vue'
import Login from '../views/Login.vue'
import About from '../views/About.vue'
import CreateOrder from '../views/CreateOrder.vue'
import GroupBooking from '../views/HomePro/GroupBooking.vue'//拼团专区页面
import Seckill from '../views/HomePro/Seckill.vue'//秒杀活动页面

Vue.use(VueRouter)

const routes = [
  // 首页我们需要默认空路径重定向到 home 下，避免空页面404
  {
    path: '/',
    name: 'home',
    redirect: '/home'
  },
  {
    path: '/login',//登入--注册--页面
    name: 'login',
    meta: {
      index: 2
    },
    // 设置组件懒加载
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue'),
  },
  {
    path: '/home',//首页
    name: 'home',
    meta: {
      index: 1
    },
    // 设置组件懒加载
    component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue'),
  },
  {
    path: '/cart',//购物车--页面
    name: 'cart',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "cart" */ '../views/Cart.vue'),
  },
  {
    path: '/category',//分类--页面
    name: 'category',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "category" */ '../views/Category.vue'),
  },
  {
    path: '/product-list',//分类列表
    name: 'product-list',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "product-list" */ '../views/ProductList.vue'),
  },
  {
    path: '/product/:id',//商品详情 //  id 作为获取商品详情的参数
    name: 'product',
    meta: {
      index: 3
    },
    component: () => import(/* webpackChunkName: "product" */ '../views/ProductDetail.vue'),
  },
  {
    path: '/user',//我的页面
    name: 'user',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "user" */ '../views/User.vue'),
  },
  {
    path: '/order',//订单--页面
    name: 'order',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "order" */ '../views/Order.vue'),
  },
  {
    path: '/order-detail',//订单详情--页面
    name: 'order-detail',
    meta: {
      index: 3
    },
    component: () => import(/* webpackChunkName: "order-detail" */ '../views/OrderDetail.vue'),
  },
  {
    path: '/setting',//账号管理--页面
    name: 'setting',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "setting" */ '../views/Setting.vue'),
  },
  {
    path: '/address',// 地址栏列表---页面
    name: 'address',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "address" */ '../views/Address.vue'),
  },
  {
    path: '/address-edit',//添加、编辑地址详情页面
    name: 'address-edit',
    meta: {
      index: 3
    },
    component: () => import(/* webpackChunkName: "address-edit" */ '../views/AddressEdit.vue'),
  },
  {
    path: '/about',//关于我们 介绍产品相关的
    name: 'about',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
  {
    path: '/create-order',//生成订单页面
    name: 'create-order',
    meta: {
      index: 2
    },
    component: () => import(/* webpackChunkName: "create-order" */ '../views/CreateOrder.vue'),
  },
  {
    path: '/GroupBooking',//拼团专区
    name: 'GroupBooking',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "groupbooking" */ '../views/HomePro/GroupBooking.vue'),
  },
  {
    path: '/Seckill',//秒杀活动
    name: 'Seckill',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "Seckill" */ '../views/HomePro/Seckill.vue'),
  },
  {
    path: '/SwiperDetails',//首页轮播图详情
    name: 'SwiperDetails',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "SwiperDetails" */ '../views/HomePro/SwiperDetails.vue'),
  },
  {
    path: '/iconlist',//横向列表页面
    name: 'iconlist',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/HomePro/iconlist.vue'),
  },
  // 首页导航列表
  {
    path: '/iconlist-1',//横向列表页面1
    name: 'iconlist-1',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-1.vue'),
  },
  {
    path: '/iconlist-2',//横向列表页面2
    name: 'iconlist-2',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-2.vue'),
  },
  {
    path: '/iconlist-3',//横向列表页面3
    name: 'iconlist-3',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-3.vue'),
  },
  {
    path: '/iconlist-4',//横向列表页面4
    name: 'iconlist-4',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-4.vue'),
  },
  {
    path: '/iconlist-5',//横向列表页面5
    name: 'iconlist-5',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-5.vue'),
  },
  {
    path: '/iconlist-6',//横向列表页面6
    name: 'iconlist-6',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-6.vue'),
  },
  {
    path: '/iconlist-7',//横向列表页面7
    name: 'iconlist-7',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-7.vue'),
  },
  {
    path: '/iconlist-8',//横向列表页面8
    name: 'iconlist-8',
    meta: {
      index: 1
    },
    component: () => import(/* webpackChunkName: "iconlist" */ '../views/Navlist/iconlist-8.vue'),
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
